#include "DebugLED.h"
#include "..\System\F2806x_Device.h"

bool DebugLED::Init()
{
	// Configure GPIO32 as a GPIO output pin
	EALLOW;

	//  GPIO-27 - PIN FUNCTION = LED for I/O Board (GREEN)
	GpioCtrlRegs.GPAMUX2.bit.GPIO24 = 0;	// 0=GPIO,  1=COMP2OUT,  2=EMU1,  3=Resv
	GpioCtrlRegs.GPADIR.bit.GPIO24 = 1;		// 1=OUTput,  0=INput 
	GpioDataRegs.GPACLEAR.bit.GPIO24 = 1;	// uncomment if --> Set Low initially
 	EDIS;
 	
	return true;
}

void DebugLED::Set(eLED led)
{
	if( led == GREEN) GpioDataRegs.GPASET.bit.GPIO24 = 1;
}

void DebugLED::Reset(eLED led)
{
	if( led == GREEN) GpioDataRegs.GPACLEAR.bit.GPIO24 = 1;
}

void DebugLED::Toggle(eLED led)
{
	if( led == GREEN) GpioDataRegs.GPATOGGLE.bit.GPIO24 = 1;
}
